package com.xiaoye.qbdatahandle.domian;

import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xiaoye.qbdatahandle.entity.ImageEntity;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.List;

/**
 * 采集结果
 *
 * @TableName collection_result
 */
@Data
@Document(collection = "collection_result")
public class CollectionResult implements Serializable {
    /**
     * 主键
     */
    @Id
    private String id;

    /**
     * 标题
     */
    @Field(name = "title", targetType = FieldType.STRING)
    private String title;

    /**
     * zhege
     * 关键词
     */
    @Field(name = "keywords", targetType = FieldType.STRING)
    private String keywords;

    /**
     * 来源
     */
    @Field(name = "source", targetType = FieldType.STRING)
    private String source;
    /**
     * 原文链接
     */
    @Field(name = "url", targetType = FieldType.STRING)
    private String url;
    /**
     * 发布时间
     */
    @ExcelProperty("发布时间")
    @Field(name = "publish_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String publishTime;
    /**
     * 简介
     */
    @Field(name = "intro", targetType = FieldType.STRING)

    private String intro;

    /**
     * 内容
     */
    @Field(name = "content", targetType = FieldType.STRING)
    private String content;

    /**
     * 创建时间
     */
    @Field(value = "create_time", targetType = FieldType.STRING)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String createTime;

    /**
     * 更新时间
     */
    @Field(value = "update_time", targetType = FieldType.STRING)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String updateTime;

    /**
     * 封面
     */
    @Field(name = "cover", targetType = FieldType.STRING)
    private String cover;

    /**
     * 备注
     */
    @Field(name = "remark", targetType = FieldType.STRING)
    private String remark;
    /**
     * 图片
     */
    @Field(name = "images", targetType = FieldType.ARRAY)
    private List<ImageEntity> images;
    /**
     * 是否清洗过
     */
    @Field(name = "is_handle", targetType = FieldType.BOOLEAN)
    private Boolean isHandle;
    /**
     * 是否分析过
     */
    @Field(name = "is_analysis", targetType = FieldType.BOOLEAN)
    private Boolean isAnalysis;
    /**
     * 任务id
     */
    @ExcelProperty("任务id")
    @Field(name = "_tid", targetType = FieldType.OBJECT_ID)
    private String tid;

    private static final long serialVersionUID = 1L;


}